<?php

	$user_name 		= $this->formText('user_name',$this->Item['user_name'],array('class'=>'txtmedium'));
	$password 		= $this->formPassword('password',$this->Item['password'],array('class'=>'txtmedium'));
	$email			= $this->formText('email',$this->Item['email'],array('class'=>'txtmedium'));
	$option 		= $this->SelectGroup;
	$group_name		= $this->formSelect('group_id',$this->Item['group_id'],array('style'=>"min-width: 200px"),$option);
	$first_name 	= $this->formText('first_name',$this->Item['first_name'],array('class'=>'txtmedium')); 
	$last_name 		= $this->formText('last_name',$this->Item['last_name'],array('class'=>'txtmedium'));
	
	$dayOptions = array(0=>'Ngày');
	for ($i = 1; $i < 32; $i++){
		$dayOptions[$i] = $i;
	}	
	$monthOptions = array(0=>'Tháng');
	for ($i = 1; $i < 13; $i++){
		$monthOptions[$i] = $i;
	}	
	$yearOptions = array(0=>'Năm');
	$y = date('Y', time()) - 4;
	for ($i = $y; $i > 1924; $i--){
		$yearOptions[$i] = $i;
	}
	if($this->flag==true){	
		$day  			= $this->formSelect('day', date('d', strtotime($this->Item['birthday'])),NULL, $dayOptions);
		$month  		= $this->formSelect('month', date('m', strtotime($this->Item['birthday'])), NULL, $monthOptions);
		$year  			= $this->formSelect('year', date('Y', strtotime($this->Item['birthday'])), NULL, $yearOptions);
		$birthday = $day. ' ' .$month . ' ' .$year;
	}else{
		$day  			= $this->formSelect('day', $this->Item['day'],NULL, $dayOptions);
		$month  		= $this->formSelect('month', $this->Item['month'], NULL, $monthOptions);
		$year  			= $this->formSelect('year', $this->Item['year'], NULL, $yearOptions);
		$birthday = $day. ' ' .$month . ' ' .$year;
	}
	
	$mobile 		= $this->formText('mobile', $this->Item['mobile'], array('class'=>'txtmedium'));
	$address = $this->formTextarea('address',$this->Item['address'],array('rows'=>7,'cols'=>40));
	
	$options = array(0=>'Không kích hoạt',1=>'Kích hoạt');
	$status		= $this->formSelect('status',$this->Item['status'], null, $options);
	
	
	if(!empty($this->Item['avt'])){
		$current_user_avatar = $this->formHidden('current_user_avatar',$this->Item['avt']);
		$user_avatar = $this->formFile('user_avatar',array('style'=>'width:250px;'));
		$linkAvatar	= FILES_URL. '/user/img100x100/'. $this->Item['avt'];
		$linkZoom   = FILES_URL. '/user/img35x35/'. $this->Item['avt'];
		$user_avatar.='<br><img src ="'.$linkAvatar.'"><br>'. $this->Item['user_avatar']. $current_user_avatar ;
		
	}else{
			$current_user_avatar = $this->formHidden('current_user_avatar',$this->Item['user_avatar']);
			$user_avatar = $this->formFile('user_avatar',array('style'=>'width:250px;'));
			if(!empty($this->Item['user_avatar'])){
				$linkAvatar	= FILES_URL. '/user/img100x100/'. $this->Item['user_avatar'];
				$linkZoom   = FILES_URL. '/user/img35x35/'. $this->Item['user_avatar'];
				$user_avatar.='<br><img src ="'.$linkAvatar.'"><br>'. $this->Item['user_avatar']. $current_user_avatar ;
			}
	}
	
	
	$arrInput = array(
						array('lable'=>'Tên đăng nhập:','input'=>$user_name ),						
						array('lable'=>'Mật khẩu:','input'=>$password ),
						array('lable'=>'Email:','input'=>$email),
						array('lable'=>'Ảnh đại diện:','input'=>$user_avatar,'style'=>'margin-left: 175px;'),
						array('lable'=>'Thuộc nhóm:','input'=>$group_name ),
						array('lable'=>'Họ và tên đệm:','input'=>$first_name ),
						array('lable'=>'Tên:','input'=>$last_name ),
						array('lable'=>'Ngày sinh:','input'=>$birthday),
						array('lable'=>'Địa chỉ:','input'=>$address),
						array('lable'=>'Điện thoại:','input'=>$mobile),
						array('lable'=>'Trạng thái:','input'=>$status ),
					);
					
	////////MESSAGES ERRORS//////////////////
	if(count($this->arrErrors)>0){
		$errors = $this->formErrors($this->arrErrors,array('id'=>'errors'));
	}
?>
<form name="appForm" method="post" action="" enctype="multipart/form-data">
						 <?php echo $this->render('admin-user/toolbar/index.php')?>
                        <div class="clr"></div>
                         <?php echo $this->render('admin-user/sublink/index.php')?>
                            <!-- IN RA LOI KHI VALIDATE -->
                         	<?php if(isset($errors))echo $errors;?>
                         	
                        <!-- BEGIN: CONTENT -->
                        <div id="element-box">
                            <div class="t">
                                <div class="t">
                                    <div class="t"></div>
                                </div>
                            </div>
                            <div class="m">
                                <!-- BEGIN: ELEMENT BOX -->
                              <div id="adminfieldset">
                                 <div class="adminheader">Chi tiết</div>
									<?php echo $this->partialLoop('row.php',$arrInput);?>
	                           </div>
	                           
	                          

                                <!-- END: ELEMENT BOX -->	
                              <div class="clr"></div>
                            </div>
                            <div class="b">
                                <div class="b">
                                    <div class="b"></div>
                                </div>
                            </div>
                        </div>
                        <!-- END: 	CONTENT -->
                    </form>